home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / maintest.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  1.5 KB  |  42 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //---------------------------------------------------------------------------
  6. #include <vcl.h>
  7. #pragma hdrstop
  8.  
  9. #include "maintest.h"
  10. #include <stdio.h>
  11. #include <comobj.hpp>
  12. //---------------------------------------------------------------------------
  13. #pragma package(smart_init)
  14. #pragma resource "*.dfm"
  15. TForm2 *Form2;
  16. //---------------------------------------------------------------------------
  17. __fastcall TForm2::TForm2(TComponent* Owner)
  18.         : TForm(Owner)
  19. {
  20. }
  21. //---------------------------------------------------------------------------
  22.  
  23. void __fastcall TForm2::Button1Click(TObject *Sender)
  24. {
  25.   try{
  26.     // Start the Server Object
  27.     MyAutoServer = CoMyAuto::Create();
  28.     MyAutoServer->ShowDialog();
  29.     //Pass strings as BSTRs
  30.     MyAutoServer->set_MyProp(WideString("This string was passed to the MyProp property of AutoProj by TestApp").c_bstr());
  31.     MyAutoServer->ShowDialog();
  32.   }
  33.   catch(EOleSysError& e){
  34.     char buf[256];
  35.     sprintf(buf, "%s.\n\n%s", e.Message.c_str(),
  36.             "Make sure you compile Srvr first and run it either from\n"
  37.             "the commmand line or from C++Builder.\n");
  38.     ShowMessage(buf);
  39.   }
  40. }
  41. //---------------------------------------------------------------------------
  42.